<template>
	<view class="detail-page">
		<u-navbar  title="" back-text="新房分销" :is-back="true"  :background="{ background: '#000' }" :back-text-style="{color:'#FFF'}" back-icon-color="#fff"> </u-navbar>
		<headinfo :info="info"/> 
		<priceinfo :info="info"/> 
		<infos :info="info"/> 
		<imgs :info="info"/> 
		
		<view class="center ccbg"> <view class="appPng"/> </view>
		<view class="center fotter" v-if="!master">
			<view class="btn join-btn " @click="doJoin()" v-if="!joined">
				参与分销
			</view>
			<view class="btn joined-btn " v-else>
				已参与分销
			</view>
		</view>
		
		<view class="center fotter">
			<view class="btn join-btn  lang" >
				<view class="tip">
					Call 经纪人:{{ info.ztUser.createBy }}
				</view>
			</view>
			<view class="btn join-btn " @click="doJoin()">
				<view class="yuyue">
					预约
				</view>
			</view>
		</view>
		
		<u-back-top :scroll-top="scrollTop"  >
			<div class="colCenter">
				<div class="back-icon b-home"><u-icon name="home" color="#fff" size="60" @click.stop="toPage('/pages/home/home')"></u-icon></div>
				<div class="back-icon b-link"><u-icon name="share" color="#fff" size="60"></u-icon></div>
				<div class="back-icon b-top">
					<u-icon name="arrow-up-fill" color="#fff" size="14"></u-icon>
					Top
				</div>
			</div>
		</u-back-top>
		
		<u-popup v-model="popStep" mode="center" width="300px" height="400px" border-radius="14" closeable>
				<popStep/>
		</u-popup>
		
		<u-popup v-model="popIdentify" mode="center" width="300px" height="400px" border-radius="14" closeable>
				<popIdentify/>
		</u-popup>
		
		<tabBar/>
	</view>
</template>

<script>
	// https://vkuviewdoc.fsq.pub/components/backTop.html
export default {
	data() {
		return {
			scrollTop: 0,
			mode: 'square',
			iconStyle: {
				fontSize: '32rpx',
				color: '#2979ff'
			},
			info:{},
			popStep:false,
			popIdentify:false,
			joined:false,
			master:false,
		}
	},
	created() {
		this.load()
	},
	onPageScroll(e) {
		this.scrollTop = e.scrollTop;
	},
	methods:{
		async load(){
			var id = uni.getStorageSync("id")
			var res = await this.ajax('/wx/property/' + id)
			console.log("物业详情property=", res);   
			var { property,joined,master } = res.data
			this.info = property
			this.joined = joined
			this.master = master
			
		},
		async doJoin(){
			/*
			已实名认证  接口 - 弹出成功
			未实名认证  弹出提示
			*/ 
		    console.log("doJoin()");
		    var f = Math.random() > 0.5 
			this.popIdentify =  f 
			if(!f){
				console.log("doJoin()",f);
				var res = await this.ajax('/wx/property/join/9')
				console.log("参与分销join=", res);   
			}
			this.popStep =  !f 
		}
	}
};
</script>

<style lang="scss">
.detail-page{
	height: 200vh;
	.center{
		padding: 5px;
	}
	.fotter{
		background: #FBD100;
		padding: 10px 0;
	}
	.join-btn{
		background-color: #fff;
		border: 2px solid #6C5945;
		color: #000;
		font-size: 18px;
		font-weight: 600;
		width: 120px;
		height: 30px;  
	}
	.joined-btn{
		background-color: #ccc;
		border: 2px solid #6C5945;
		color: #fff;
		font-size: 18px;
		font-weight: 600;
		width: 120px;
		height: 30px; 
	}
	.lang{
		width: 200px;
		margin-right: 20px;
	}
	.tip{
		padding: 5px 20px;
		
	}
	.yuyue{
		font-weight: 400;
	}
	.back-icon{
		background: #585657;
		margin: 2px;
		padding: 2px;
		color: #fff;
		text-align: center;
		
	}
}
</style>